﻿using MediatR;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using xiaodingmarket_application.Service;
using xiaodingmarket_Domain_core.Bus;
using xiaodingmarket_Domain_core.Notificatiions;

namespace xiaodingmarket_service.Controllers
{
	//[Authorize]
	public class redistestController: ApiController
	{
		private readonly redisTest _redistest;
		public redistestController(redisTest demoService,INotificationHandler<DomainNotification> notifications,IMediatorHandler mediator) : base(notifications, mediator)
		{
			_redistest = demoService;
		}
		[HttpGet]
		[AllowAnonymous]  //可以让所有人访问
		[Route("redis")]
		public async Task<string> Get()
		{
			var model = await _redistest.GetTime();
			return $"{model.Id}:{model.Time}";
		}
	}
}
